﻿@model IEnumerable<WebVideo.EntitySTT_Comment>
@{
    ViewBag.Title = "Wall";
}
<div class="inner-container" id="inner-container" style="width: 8000px">
    <div class="wrap-widget">
        <div class="inner-widget _7">
            <h1>Trang bạn bè</h1>
            <div class="widget _2x3 phone bg-color-MediumSeaGreen">
                <div class="widget-content">
                    @Html.Action("Index", "Individual", new { Friend = Request.Cookies["UserId"].Value })
                </div>
                <!--/ .widget-content-->
            </div>
            <!--/ .widget-->
            <div class="widget _5x3 phone bg-color-white">
                <div class="box-social-wrapper contScroll">
                    @{
                        if (Model.ToList().Count <= 0)
                        {
                        
                        <h4>Hiện tại không có trạng thái nào được đăng </h4>
                        }
                    }

                    @{
                        foreach (var item in Model)
                        {
                            string iddel = @item.Id + "del"; 
                        <div class="box-social" id ="@iddel">
                            @{ 
                            if (item.UserName == Request.Cookies["UserId"].Value)
                            {
                                <li class="dropdown">
                                    <a href="#" class="dropdown-toggle" data-toggle="dropdown"><b class="caret"></b></a>
                                    <ul class="dropdown-menu">
                                        @* <li><a href="#frmEditCmt" role="button" data-toggle="modal">Sửa</a></li>*@
                                        <li><a href="#" onclick="return DeleteStatus(@item.Id)">Xóa</a></li>
                                    </ul>
                                </li>
                            }
                            }

                            <div class="avatar">

                                @{
                            if (item.EntityUser.Avatar != null)
                            {
                                    <img src="/Content/Images/Avatar/@item.EntityUser.Avatar" />
                            }
                            else
                            {
                                    <img src="/Content/Images/Avatar/AdminAvatar.jpg" />
                            }
                                }
                            </div>
                            <p class="user-name"><a href="@Url.Action("ThongTinCaNhan", "Individual", new { Friend = @item.UserName }, null)">@item.EntityUser.Name</a></p>
                            <div class="status">
                                @item.Des
                            </div>
                            <div class="like-cmt-time">

                                <span>@item.Date.Value.ToString("hh:mm dd-MM-yyyy")</span>&nbsp;.&nbsp;
                                 <a href="#" onclick="return LikeSatus(@item.Id)">Thích</a>&nbsp;.&nbsp;
                                 @{
                            string idst = @item.Id + "st";
                                     <a href="#" class="n-like" data-toggle="tooltip" id ="@idst" data-placement="top">@item.Likes</a>
                                 }
                            </div>
                            <div class="comment-full">
                                @{string idd = @item.Id + "cm";
                                    <div id ="@idd">

                                        @Html.Action("WallComment", "Individual", new { IdCom = @item.Id, Comment = "", IdDelete = 0, IdLike = 0 })
                                    </div>
                                }
                            </div>
                            <!--/ .comment-full-->
                        </div>  
                        }                           
                        <!--/ .box-social-->                           
                                      
                    }

                </div>
                <!--/ .box-social-wrapper-->
            </div>
            <!--/ .widget-->
        </div>
        <!--/ .inner-widget-->
    </div>
    <!--/ .wrap-widget -->
</div>
<!--/ .inner-container-->
@section occasionalScripts {
    <script type="text/javascript" src="@Url.Content("~/Content/cssFrontEnd/js/jquery.min.js")" ></script>
    <script type="text/javascript" src="@Url.Content("~/Content/cssFrontEnd/js/load.js")" ></script>
    <script type="text/javascript" src="@Url.Content("~/Content/cssFrontEnd/js/styles.js")" ></script>
    <script type="text/javascript" src="@Url.Content("~/Content/cssFrontEnd/js/jquery.nicescroll.min.js")" ></script>
}
<script type="text/javascript">
    document.body.className = 'no-js';
    $(document).ready(function () {
        $('li#TaiKhoanCuaBan').addClass('active');
    });
    function Comment(e, IdRoot) {
        var key;

        if (window.event)
            key = window.event.keyCode;     //IE 
        else
            key = e.which;     //firefox 

        if (key == 13) {
            var getURL = '@Url.Action("WallComment", "Individual")';
            var Comment = $("#" + IdRoot + "").val();
            $.get(getURL, { "IdCom": IdRoot, "Comment": Comment, "IdDelete": 0, "IdLike": 0 }, function (data) {
                $("div#" + IdRoot + "cm").html(data);
            });
        }
    }
    function LikeComment(IdRoot, Id) {

        var getURL = '@Url.Action("WallComment", "Individual")';
         $.get(getURL, { "IdCom": IdRoot, "Comment": "", "IdDelete": 0, "IdLike": Id }, function (data) {
             $("div#" + IdRoot + "cm").html(data);
         });
     }
     function DeleteComment(IdRoot, Id) {

         var getURL = '@Url.Action("WallComment", "Individual")';
         $.get(getURL, { "IdCom": IdRoot, "Comment": "", "IdDelete": Id, "IdLike": 0 }, function (data) {
             $("div#" + IdRoot + "cm").html(data);
         });
     }
     function LikeSatus(Id) {

         var getURL = '@Url.Action("Likes", "Individual")';

         $.get(getURL, { "Id": Id }, function (data) {
             if (data != "Error")
                 $("a#" + Id + "st").text(data);
         });
     }
     function DeleteStatus(Id) {

         var getURL = '@Url.Action("DeleteStatus", "Individual")';

         $.get(getURL, { "Id": Id }, function (data) {
             if (data != "Error")
                 $("div#" + Id + "del").fadeOut(1000);
         });
     }

</script>
